home *** CD-ROM | disk | FTP | other *** search
/ NetObjects Fusion 7 / Fusion7.iso / NetObjects Fusion / data1.cab / Language_Resource_-_English / Components / TickerTape / TickerTape.class (.txt) next >
Encoding:
Java Class File  |  2002-10-18  |  30.3 KB  |  857 lines

  1. import java.applet.Applet;
  2. import java.awt.Color;
  3. import java.awt.Component;
  4. import java.awt.Container;
  5. import java.awt.Dimension;
  6. import java.awt.Event;
  7. import java.awt.Font;
  8. import java.awt.FontMetrics;
  9. import java.awt.Frame;
  10. import java.awt.Graphics;
  11. import java.awt.Image;
  12. import java.net.MalformedURLException;
  13. import java.net.URL;
  14. import java.util.Vector;
  15.  
  16. public class TickerTape extends Applet implements Runnable {
  17.    int[] starts;
  18.    URL[] theURLs;
  19.    int numTokens;
  20.    long speed = 250L;
  21.    int theOffScreenPosition;
  22.    int theDisplayWidth;
  23.    int frameThickness;
  24.    int ledSize;
  25.    int scrollFactor;
  26.    int ledSpacing;
  27.    int ledType;
  28.    Thread tickTock;
  29.    Graphics offScreenGraphics;
  30.    Dimension offScreenSize;
  31.    Image offScreenImage;
  32.    Color frameColour;
  33.    Color backGround;
  34.    Color LEDColour;
  35.    Color LEDOffColour;
  36.    int theXOffset;
  37.    int theYOffset;
  38.    URL theURLToGoTo = null;
  39.    boolean mouseOut = true;
  40.    boolean notUpdatedYet = true;
  41.    Frame browserFrame = null;
  42.    int[][] itsData = new int[][]{{0, 0, 0, 0, 0, 0}, {0, 0, 380, 0, 0, 0}, {0, 12, 0, 12, 0, 0}, {80, 248, 80, 248, 80, 0}, {16, 168, 508, 168, 64, 0}, {140, 76, 32, 400, 392, 0}, {200, 308, 340, 136, 320, 0}, {0, 0, 12, 0, 0, 0}, {0, 248, 260, 0, 0, 0}, {0, 0, 260, 248, 0, 0}, {168, 112, 508, 112, 168, 0}, {0, 32, 112, 32, 0, 0}, {0, 512, 384, 0, 0, 0}, {0, 32, 32, 32, 0, 0}, {0, 0, 256, 0, 0, 0}, {128, 64, 32, 16, 8, 0}, {112, 136, 260, 136, 112, 0}, {0, 272, 508, 256, 0, 0}, {408, 324, 324, 292, 280, 0}, {136, 260, 260, 292, 216, 0}, {48, 40, 36, 508, 32, 0}, {316, 292, 292, 292, 192, 0}, {248, 292, 292, 292, 192, 0}, {0, 4, 388, 100, 28, 0}, {216, 292, 292, 292, 216, 0}, {24, 292, 292, 292, 248, 0}, {0, 0, 160, 0, 0, 0}, {0, 512, 416, 0, 0, 0}, {0, 32, 80, 136, 0, 0}, {0, 80, 80, 80, 0, 0}, {0, 136, 80, 32, 0, 0}, {8, 4, 324, 36, 24, 0}, {248, 260, 372, 340, 56, 0}, {496, 72, 68, 72, 496, 0}, {508, 292, 292, 292, 216, 0}, {248, 260, 260, 260, 136, 0}, {508, 260, 260, 260, 248, 0}, {508, 292, 292, 292, 260, 0}, {508, 36, 36, 4, 4, 0}, {248, 260, 260, 292, 232, 0}, {508, 32, 32, 32, 508, 0}, {0, 0, 508, 0, 0, 0}, {192, 256, 256, 256, 252, 0}, {508, 32, 80, 136, 260, 0}, {508, 256, 256, 256, 256, 0}, {508, 8, 16, 8, 508, 0}, {508, 8, 16, 32, 508, 0}, {248, 260, 260, 260, 248, 0}, {508, 36, 36, 36, 24, 0}, {248, 260, 324, 388, 504, 0}, {508, 36, 100, 164, 280, 0}, {152, 292, 292, 292, 200, 0}, {4, 4, 508, 4, 4, 0}, {252, 256, 256, 256, 252, 0}, {124, 128, 256, 128, 124, 0}, {252, 256, 128, 256, 252, 0}, {260, 136, 112, 136, 260, 0}, {12, 16, 480, 16, 12, 0}, {388, 324, 292, 276, 268, 0}, {0, 508, 260, 260, 0, 0}, {8, 16, 32, 64, 128, 0}, {0, 260, 260, 508, 0, 0}, {0, 32, 16, 32, 0, 0}, {256, 256, 256, 256, 256, 0}, {0, 4, 8, 0, 0, 0}, {128, 336, 336, 224, 256, 0}, {508, 288, 272, 272, 224, 0}, {224, 272, 272, 272, 0, 0}, {224, 272, 272, 292, 508, 0}, {224, 336, 336, 336, 96, 0}, {16, 504, 20, 4, 0, 0}, {224, 1296, 1296, 1296, 992, 0}, {4, 508, 16, 16, 480, 0}, {0, 0, 500, 0, 0, 0}, {512, 1024, 1012, 0, 0, 0}, {0, 508, 64, 160, 272, 0}, {0, 4, 508, 0, 0, 0}, {480, 16, 96, 16, 480, 0}, {496, 16, 16, 480, 0, 0}, {224, 272, 272, 272, 224, 0}, {2032, 160, 272, 272, 224, 0}, {224, 272, 272, 160, 2032, 0}, {0, 496, 32, 16, 16, 0}, {288, 336, 336, 336, 144, 0}, {0, 16, 252, 272, 0, 0}, {240, 256, 256, 256, 240, 0}, {48, 192, 256, 192, 48, 0}, {240, 256, 192, 256, 240, 0}, {272, 160, 64, 160, 272, 0}, {0, 1264, 1280, 768, 240, 0}, {272, 400, 336, 304, 272, 0}, {0, 32, 216, 260, 0, 0}, {0, 0, 508, 0, 0, 0}, {0, 260, 216, 32, 0, 0}, {32, 16, 32, 64, 32, 0}, {0, 0, 500, 0, 0, 0}, {224, 272, 1016, 272, 0, 0}, {278, 249, 273, 273, 128, 0}, {136, 112, 80, 112, 136, 0}, {44, 56, 488, 56, 44, 0}, {0, 0, 476, 0, 0, 0}, {56, 340, 340, 340, 224, 0}, {0, 4, 0, 4, 0, 0}, {248, 372, 396, 340, 248, 0}, {80, 106, 106, 106, 124, 0}, {32, 80, 168, 80, 136, 0}, {32, 32, 32, 32, 224, 0}, {32, 32, 32, 32, 32, 0}, {500, 212, 292, 260, 504, 0}, {0, 4, 4, 4, 0, 0}, {0, 7, 5, 7, 0, 0}, {0, 160, 240, 160, 0, 0}, {0, 9, 13, 11, 0, 0}, {0, 9, 11, 13, 0, 0}, {0, 4, 2, 0, 0, 0}, {1024, 1008, 256, 256, 240, 0}, {24, 36, 36, 508, 508, 0}, {0, 56, 56, 56, 0, 0}, {0, 1024, 1536, 0, 0, 0}, {0, 2, 15, 0, 0, 0}, {92, 98, 98, 98, 92, 0}, {136, 80, 168, 80, 32, 0}, {132, 94, 160, 208, 488, 0}, {68, 62, 336, 424, 320, 0}, {146, 86, 186, 208, 488, 0}, {128, 256, 276, 288, 192, 0}, {496, 73, 70, 72, 496, 0}, {496, 74, 69, 72, 496, 0}, {496, 74, 69, 74, 496, 0}, {498, 73, 70, 73, 496, 0}, {496, 74, 68, 74, 496, 0}, {496, 75, 71, 75, 496, 0}, {504, 36, 508, 292, 292, 0}, {248, 1284, 1796, 260, 136, 0}, {508, 293, 294, 292, 292, 0}, {508, 294, 293, 292, 292, 0}, {508, 294, 293, 294, 292, 0}, {508, 294, 292, 294, 292, 0}, {0, 0, 509, 2, 0, 0}, {0, 2, 509, 0, 0, 0}, {0, 2, 509, 2, 0, 0}, {0, 2, 508, 2, 0, 0}, {0, 0, 128, 320, 0, 0}, {510, 9, 18, 33, 508, 0}, {248, 261, 262, 260, 248, 0}, {248, 262, 261, 260, 248, 0}, {248, 262, 261, 262, 248, 0}, {250, 261, 262, 261, 248, 0}, {248, 262, 260, 262, 248, 0}, {0, 80, 32, 80, 0, 0}, {240, 200, 168, 152, 120, 0}, {252, 257, 258, 256, 252, 0}, {252, 258, 257, 256, 252, 0}, {252, 258, 257, 258, 252, 0}, {252, 258, 256, 258, 252, 0}, {12, 18, 481, 16, 12, 0}, {16, 504, 20, 492, 0, 0}, {508, 276, 276, 296, 192, 0}, {128, 338, 340, 224, 256, 0}, {128, 340, 338, 224, 256, 0}, {128, 340, 338, 228, 256, 0}, {132, 338, 340, 226, 256, 0}, {128, 340, 336, 228, 256, 0}, {128, 342, 342, 224, 256, 0}, {400, 336, 224, 336, 352, 0}, {224, 1296, 1808, 272, 0, 0}, {224, 338, 340, 336, 96, 0}, {224, 340, 338, 336, 96, 0}, {224, 340, 338, 340, 96, 0}, {224, 340, 336, 340, 96, 0}, {0, 2, 500, 0, 0, 0}, {0, 4, 498, 0, 0, 0}, {0, 4, 498, 4, 0, 0}, {0, 4, 496, 4, 0, 0}, {0, 0, 280, 128, 0, 0}, {500, 18, 20, 482, 0, 0}, {224, 274, 276, 272, 224, 0}, {224, 276, 274, 272, 224, 0}, {224, 276, 274, 276, 224, 0}, {228, 274, 276, 274, 224, 0}, {224, 276, 272, 276, 224, 0}, {32, 32, 168, 32, 32, 0}, {224, 400, 336, 304, 224, 0}, {240, 258, 260, 256, 240, 0}, {240, 260, 258, 256, 240, 0}, {240, 260, 258, 260, 240, 0}, {240, 260, 256, 260, 240, 0}, {0, 1268, 1282, 768, 240, 0}, {16, 504, 20, 508, 0, 0}, {0, 1268, 1280, 772, 240, 0}};
  43.    String[] theEntities = new String[]{"�", "", "", "", "", "", "", "", "", " ", " ", " ", " ", " ", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "&sp;", "!", """, "#", "$", "%", "&", "'", "(", ")", "*", "+", ",", "‐", ".", "/", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ":", ";", "<", "=", ">", "?", "@", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "[", "\", "]", "ˆ", "_", "`", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "{", "|", "}", "˜", "", "€", "", "‚", "ƒ", "„", "…", "†", "‡", "ˆ", "‰", "Š", "‹", "Œ", "", "Ž", "", "", "‘", "’", "“", "”", "•", "–", "—", "˜", "™", "š", "›", "œ", "", "ž", "Ÿ", " ", "¡", "¢", "£", "¤", "¥", "¦", "§", "¨", "©", "ª", "«", "¬", "­", "®", "&hibar;", "°", "±", "²", "³", "´", "µ", "¶", "·", "¸", "¹", "º", "»", "¼", "½", "¾", "¿", "À", "Á", "Â", "Ã", "Ä", "Å", "Æ", "Ç", "È", "É", "Ê", "Ë", "Ì", "Í", "Î", "Ï", "Ð", "Ñ", "Ò", "Ó", "Ô", "Õ", "Ö", "×", "Ø", "Ù", "Ú", "Û", "Ü", "Ý", "Þ", "ß", "à", "á", "â", "ã", "ä", "å", "æ", "ç", "è", "é", "ê", "ë", "ì", "í", "î", "ï", "ð", "ñ", "ò", "ó", "ô", "õ", "ö", "÷", "ø", "ù", "ú", "û", "ü", "ý", "þ", "ÿ"};
  44.  
  45.    public void setBackgroundColor(String color) {
  46.       this.backGround = this.GetColourFromString(color);
  47.       this.DrawOffScreenBackground();
  48.       ((Component)this).repaint();
  49.    }
  50.  
  51.    Frame getBrowserFrame() {
  52.       Container parentFrame;
  53.       for(parentFrame = ((Component)this).getParent(); parentFrame != null && !(parentFrame instanceof Frame); parentFrame = ((Component)parentFrame).getParent()) {
  54.       }
  55.  
  56.       return (Frame)parentFrame;
  57.    }
  58.  
  59.    public void init() {
  60.       this.browserFrame = this.getBrowserFrame();
  61.       String param = ((Applet)this).getParameter("speed");
  62.       this.SetSpeed(param == null ? 100L : 5L * (51L - Integer.valueOf(param).longValue()));
  63.       param = ((Applet)this).getParameter("framecolour");
  64.       if (param == null) {
  65.          param = ((Applet)this).getParameter("framecolor");
  66.       }
  67.  
  68.       this.frameColour = param == null ? Color.green : this.GetColourFromString(param);
  69.       param = ((Applet)this).getParameter("backcolour");
  70.       if (param == null) {
  71.          param = ((Applet)this).getParameter("backcolor");
  72.       }
  73.  
  74.       this.backGround = param == null ? Color.black : this.GetColourFromString(param);
  75.       param = ((Applet)this).getParameter("LEDcolour");
  76.       if (param == null) {
  77.          param = ((Applet)this).getParameter("LEDcolor");
  78.       }
  79.  
  80.       this.LEDColour = param == null ? Color.green : this.GetColourFromString(param);
  81.       param = ((Applet)this).getParameter("ledoffcolour");
  82.       if (param == null) {
  83.          param = ((Applet)this).getParameter("ledoffcolor");
  84.       }
  85.  
  86.       this.LEDOffColour = param == null ? this.backGround : this.GetColourFromString(param);
  87.       param = ((Applet)this).getParameter("FrameThick");
  88.       this.frameThickness = param == null ? 1 : Integer.valueOf(param);
  89.       param = ((Applet)this).getParameter("LEDSize");
  90.       this.ledSize = param == null ? 2 : Integer.valueOf(param);
  91.       param = ((Applet)this).getParameter("scrollfactor");
  92.       this.scrollFactor = param == null ? 2 : Integer.valueOf(param);
  93.       param = ((Applet)this).getParameter("ledspacing");
  94.       this.ledSpacing = param == null ? 1 : Integer.valueOf(param);
  95.       param = ((Applet)this).getParameter("ledtype");
  96.       this.ledType = param == null ? 2 : Integer.valueOf(param);
  97.       if (this.ledType > 2) {
  98.          this.ledType = 2;
  99.       }
  100.  
  101.       if (this.ledSize == 1 && this.ledType == 1) {
  102.          this.ledType = 0;
  103.       }
  104.  
  105.       param = ((Applet)this).getParameter("width");
  106.       int theWidth = param == null ? 80 : Integer.valueOf(param);
  107.       param = ((Applet)this).getParameter("height");
  108.       int theHeight = param == null ? 39 : Integer.valueOf(param);
  109.       ((Applet)this).resize(theWidth, theHeight);
  110.       this.theDisplayWidth = theWidth - this.frameThickness * 2 - 1;
  111.       this.theXOffset = this.frameThickness + 1;
  112.       this.theYOffset = (theHeight - (this.ledSize + this.ledSpacing) * 11) / 2;
  113.       String allTheText = "";
  114.       Vector theTexts = new Vector();
  115.  
  116.       String theText;
  117.       for(int cnt = 1; (theText = ((Applet)this).getParameter(String.valueOf("text").concat(String.valueOf(cnt)))) != null; ++cnt) {
  118.          int theTextLength = theText.length();
  119.          StringBuffer finalText = new StringBuffer();
  120.  
  121.          for(int i = 0; i < theTextLength; ++i) {
  122.             if (theText.charAt(i) != '&') {
  123.                finalText.append(theText.charAt(i));
  124.             } else {
  125.                int semiColon = theText.indexOf(59, i + 1);
  126.                int theChar;
  127.                if (semiColon != -1) {
  128.                   theChar = this.HTMLtoISO(theText.substring(i, semiColon + 1));
  129.                   if (theChar == 0) {
  130.                      theChar = 38;
  131.                   } else {
  132.                      i = semiColon;
  133.                   }
  134.                } else {
  135.                   theChar = 38;
  136.                }
  137.  
  138.                finalText.append((char)theChar);
  139.             }
  140.          }
  141.  
  142.          theText = finalText.toString();
  143.          allTheText = String.valueOf(allTheText).concat(String.valueOf(theText));
  144.          theTexts.addElement(theText);
  145.       }
  146.  
  147.       this.numTokens = theTexts.size();
  148.       this.starts = new int[this.numTokens + 1];
  149.       this.starts[0] = this.theDisplayWidth;
  150.       theText = allTheText;
  151.       if (this.ledType == 2) {
  152.          int theTextLength = allTheText.length();
  153.          Font theFont = new Font("SansSerif", 1, 10 * this.ledSize);
  154.          FontMetrics theFontMetrics = ((Component)this).getFontMetrics(theFont);
  155.          int theTextHeight = theFontMetrics.getMaxAscent() + theFontMetrics.getMaxDescent();
  156.          int theTextWidth = theFontMetrics.charsWidth(allTheText.toCharArray(), 0, theTextLength) + this.ledSpacing * theTextLength;
  157.          this.offScreenSize = new Dimension(this.theDisplayWidth * 2 + theTextWidth, theTextHeight + 1);
  158.          this.offScreenImage = ((Component)this).createImage(this.offScreenSize.width, this.offScreenSize.height);
  159.          this.offScreenGraphics = this.offScreenImage.getGraphics();
  160.          this.theOffScreenPosition = this.theDisplayWidth;
  161.          this.offScreenGraphics.setFont(theFont);
  162.          this.DrawOffScreenBackground();
  163.          int displacement = this.theDisplayWidth - 1;
  164.          int cumulativeWidth = 0;
  165.          this.offScreenGraphics.setColor(this.LEDColour);
  166.  
  167.          for(int i = 0; i < this.numTokens; ++i) {
  168.             String theMessage = (String)theTexts.elementAt(i);
  169.  
  170.             for(int j = 0; j < theMessage.length(); ++j) {
  171.                this.offScreenGraphics.drawChars(theMessage.toCharArray(), j, 1, displacement + cumulativeWidth, theTextHeight - theFontMetrics.getMaxDescent());
  172.                cumulativeWidth += theFontMetrics.charWidth(theMessage.charAt(j)) + this.ledSpacing;
  173.             }
  174.  
  175.             this.starts[i + 1] = this.starts[i] + theFontMetrics.stringWidth(theMessage);
  176.          }
  177.       } else {
  178.          for(int cnt = 1; cnt <= this.numTokens; ++cnt) {
  179.             this.starts[cnt] = this.starts[cnt - 1] + ((String)theTexts.elementAt(cnt - 1)).length() * 6 * (this.ledSize + this.ledSpacing);
  180.          }
  181.  
  182.          int theTextLength = allTheText.length();
  183.          int theNumberOfLines = allTheText.length() * 6 + 2 * this.theDisplayWidth / (this.ledSize + this.ledSpacing);
  184.          this.offScreenSize = new Dimension(theNumberOfLines * (this.ledSize + this.ledSpacing), (this.ledSize + this.ledSpacing) * 11);
  185.          this.offScreenImage = ((Component)this).createImage(this.offScreenSize.width, this.offScreenSize.height);
  186.          this.offScreenGraphics = this.offScreenImage.getGraphics();
  187.          this.theOffScreenPosition = this.theDisplayWidth;
  188.          this.DrawOffScreenBackground();
  189.          theNumberOfLines = this.theDisplayWidth / (this.ledSize + this.ledSpacing);
  190.          this.offScreenGraphics.setColor(this.LEDOffColour);
  191.  
  192.          for(int i = 0; i < theNumberOfLines; ++i) {
  193.             for(int k = 0; k < 11; ++k) {
  194.                if (this.ledType == 0) {
  195.                   this.offScreenGraphics.fillRect(i * (this.ledSize + this.ledSpacing), k * (this.ledSize + this.ledSpacing), this.ledSize, this.ledSize);
  196.                } else {
  197.                   this.offScreenGraphics.fillOval(i * (this.ledSize + this.ledSpacing), k * (this.ledSize + this.ledSpacing), this.ledSize, this.ledSize);
  198.                }
  199.             }
  200.          }
  201.  
  202.          int displacement = (theNumberOfLines - 1) * (this.ledSize + this.ledSpacing);
  203.  
  204.          for(int var29 = 0; var29 < theTextLength; ++var29) {
  205.             for(int j = 0; j < 6; ++j) {
  206.                int theLine = this.GetLine(theText.charAt(var29), j);
  207.  
  208.                for(int k = 0; k < 11; ++k) {
  209.                   int theBit = theLine >> k;
  210.                   if ((theBit & 1) == 1) {
  211.                      this.offScreenGraphics.setColor(this.LEDColour);
  212.                   } else {
  213.                      this.offScreenGraphics.setColor(this.LEDOffColour);
  214.                   }
  215.  
  216.                   if (this.ledType == 0) {
  217.                      this.offScreenGraphics.fillRect(displacement + (var29 * 6 + j) * (this.ledSize + this.ledSpacing), k * (this.ledSize + this.ledSpacing), this.ledSize, this.ledSize);
  218.                   } else {
  219.                      this.offScreenGraphics.fillOval(displacement + (var29 * 6 + j) * (this.ledSize + this.ledSpacing), k * (this.ledSize + this.ledSpacing), this.ledSize, this.ledSize);
  220.                   }
  221.                }
  222.             }
  223.          }
  224.  
  225.          displacement += theTextLength * 6 * (this.ledSize + this.ledSpacing);
  226.          theNumberOfLines = this.theDisplayWidth / (this.ledSize + this.ledSpacing);
  227.          this.offScreenGraphics.setColor(this.LEDOffColour);
  228.  
  229.          for(int var30 = 0; var30 < theNumberOfLines; ++var30) {
  230.             for(int k = 0; k < 11; ++k) {
  231.                if (this.ledType == 0) {
  232.                   this.offScreenGraphics.fillRect(displacement + var30 * (this.ledSize + this.ledSpacing), k * (this.ledSize + this.ledSpacing), this.ledSize, this.ledSize);
  233.                } else {
  234.                   this.offScreenGraphics.fillOval(displacement + var30 * (this.ledSize + this.ledSpacing), k * (this.ledSize + this.ledSpacing), this.ledSize, this.ledSize);
  235.                }
  236.             }
  237.          }
  238.       }
  239.  
  240.       this.theURLs = new URL[this.numTokens];
  241.  
  242.       for(int cnt = 1; cnt <= this.numTokens; ++cnt) {
  243.          param = ((Applet)this).getParameter(String.valueOf("link").concat(String.valueOf(cnt)));
  244.          if (param != null) {
  245.             try {
  246.                this.theURLToGoTo = this.MakeAbsoluteURL(param);
  247.             } catch (MalformedURLException var26) {
  248.                this.theURLToGoTo = null;
  249.             }
  250.  
  251.             this.theURLs[cnt - 1] = this.theURLToGoTo;
  252.          }
  253.       }
  254.  
  255.    }
  256.  
  257.    private URL MakeAbsoluteURL(String param) throws MalformedURLException {
  258.       URL theURL = null;
  259.       String fullBase = ((Applet)this).getDocumentBase().toString();
  260.       String documentBase = fullBase.substring(0, fullBase.lastIndexOf(47));
  261.  
  262.       try {
  263.          if (param.startsWith(".")) {
  264.             param = param.replace('\\', '/');
  265.             param = String.valueOf(String.valueOf(documentBase).concat(String.valueOf("/"))).concat(String.valueOf(param));
  266.          } else if (param.startsWith("#")) {
  267.             param = String.valueOf(((Applet)this).getDocumentBase().toString()).concat(String.valueOf(param));
  268.          } else if (!param.startsWith("cid:") && !param.startsWith("lifn:") && !param.startsWith("java:") && !param.startsWith("irc:") && !param.startsWith("IOR:") && !param.startsWith("ilu:") && !param.startsWith("https:") && !param.startsWith("http:") && !param.startsWith("hdl:") && !param.startsWith("gopher:") && !param.startsWith("ftp:") && !param.startsWith("finger:") && !param.startsWith("file:") && !param.startsWith("data:") && !param.startsWith("clsid:") && !param.startsWith("md5:") && !param.startsWith("mailserver:") && !param.startsWith("mailto:") && !param.startsWith("mid:") && !param.startsWith("news:") && !param.startsWith("nntp:") && !param.startsWith("path:") && !param.startsWith("prospero:") && !param.startsWith("service:") && !param.startsWith("shttp") && !param.startsWith("snews") && !param.startsWith("STANF:") && !param.startsWith("telnet:") && !param.startsWith("vemmi:") && !param.startsWith("wais:") && !param.startsWith("whois++:")) {
  269.             param = String.valueOf("http://").concat(String.valueOf(param));
  270.          }
  271.  
  272.          theURL = new URL(param);
  273.       } catch (MalformedURLException var6) {
  274.          theURL = null;
  275.       }
  276.  
  277.       return theURL;
  278.    }
  279.  
  280.    private void DrawOffScreenBackground() {
  281.       this.offScreenGraphics.setColor(this.backGround);
  282.       this.offScreenGraphics.fillRect(0, 0, this.offScreenSize.width, this.offScreenSize.height);
  283.    }
  284.  
  285.    public void paint(Graphics g) {
  286.       Color oldColour = g.getColor();
  287.       g.setColor(this.frameColour);
  288.       g.fillRect(0, 0, ((Component)this).bounds().width, ((Component)this).bounds().height);
  289.       g.setColor(this.backGround);
  290.       g.fillRect(this.frameThickness, this.frameThickness, this.theDisplayWidth, ((Component)this).bounds().height - this.frameThickness * 2 - 1);
  291.       this.update(g);
  292.       g.setColor(oldColour);
  293.    }
  294.  
  295.    public final synchronized void update(Graphics g) {
  296.       g.clipRect(this.theXOffset, this.theYOffset, this.theDisplayWidth - 2, this.offScreenSize.height);
  297.       int theTranslation = this.theOffScreenPosition > this.theDisplayWidth ? this.theOffScreenPosition - this.theDisplayWidth : -(this.theDisplayWidth - this.theOffScreenPosition);
  298.       g.drawImage(this.offScreenImage, -theTranslation + this.theXOffset, this.theYOffset, this);
  299.       this.theOffScreenPosition += (this.ledSize + this.ledSpacing) * this.scrollFactor;
  300.       if (this.theOffScreenPosition > this.offScreenSize.width) {
  301.          this.theOffScreenPosition = this.theDisplayWidth;
  302.       }
  303.  
  304.    }
  305.  
  306.    public Color GetColourFromString(String theParam) {
  307.       if (theParam.equalsIgnoreCase("BLACK")) {
  308.          return Color.black;
  309.       } else if (theParam.equalsIgnoreCase("BLUE")) {
  310.          return Color.blue;
  311.       } else if (theParam.equalsIgnoreCase("CYAN")) {
  312.          return Color.cyan;
  313.       } else if (theParam.equalsIgnoreCase("DARKGRAY")) {
  314.          return Color.darkGray;
  315.       } else if (theParam.equalsIgnoreCase("GRAY")) {
  316.          return Color.gray;
  317.       } else if (theParam.equalsIgnoreCase("GREEN")) {
  318.          return Color.green;
  319.       } else if (theParam.equalsIgnoreCase("LIGHTGRAY")) {
  320.          return Color.lightGray;
  321.       } else if (theParam.equalsIgnoreCase("MAGENTA")) {
  322.          return Color.magenta;
  323.       } else if (theParam.equalsIgnoreCase("ORANGE")) {
  324.          return Color.orange;
  325.       } else if (theParam.equalsIgnoreCase("PINK")) {
  326.          return Color.pink;
  327.       } else if (theParam.equalsIgnoreCase("RED")) {
  328.          return Color.red;
  329.       } else if (theParam.equalsIgnoreCase("WHITE")) {
  330.          return Color.white;
  331.       } else {
  332.          return theParam.equalsIgnoreCase("YELLOW") ? Color.yellow : Color.black;
  333.       }
  334.    }
  335.  
  336.    public boolean mouseMove(Event evt, int x, int y) {
  337.       if (this.theURLToGoTo != null && this.notUpdatedYet) {
  338.          this.notUpdatedYet = false;
  339.       }
  340.  
  341.       return true;
  342.    }
  343.  
  344.    public boolean mouseDrag(Event evt, int x, int y) {
  345.       if (this.theURLToGoTo != null && this.notUpdatedYet) {
  346.          this.notUpdatedYet = false;
  347.       }
  348.  
  349.       return true;
  350.    }
  351.  
  352.    public boolean mouseEnter(Event evt, int x, int y) {
  353.       if (this.theURLToGoTo != null) {
  354.       }
  355.  
  356.       if (this.browserFrame != null) {
  357.          this.browserFrame.setCursor(12);
  358.       }
  359.  
  360.       this.mouseOut = false;
  361.       return true;
  362.    }
  363.  
  364.    public boolean mouseDown(Event evt, int x, int y) {
  365.       if (this.theURLToGoTo != null) {
  366.       }
  367.  
  368.       return true;
  369.    }
  370.  
  371.    public boolean mouseUp(Event evt, int x, int y) {
  372.       int cnt = -1;
  373.       int position = x + this.theOffScreenPosition - this.theDisplayWidth;
  374.       if (position >= this.starts[0] && position < this.starts[this.numTokens]) {
  375.          for(cnt = 1; cnt < this.numTokens && position >= this.starts[cnt]; ++cnt) {
  376.          }
  377.  
  378.          this.theURLToGoTo = this.theURLs[cnt - 1];
  379.       } else {
  380.          this.theURLToGoTo = null;
  381.       }
  382.  
  383.       if (this.theURLToGoTo != null && !this.mouseOut) {
  384.          String target = ((Applet)this).getParameter(String.valueOf("Target").concat(String.valueOf(cnt)));
  385.          if (target != null) {
  386.             ((Applet)this).getAppletContext().showDocument(this.theURLToGoTo, target);
  387.          } else {
  388.             ((Applet)this).getAppletContext().showDocument(this.theURLToGoTo);
  389.          }
  390.       }
  391.  
  392.       return true;
  393.    }
  394.  
  395.    public boolean mouseExit(Event evt, int x, int y) {
  396.       this.notUpdatedYet = true;
  397.       this.mouseOut = true;
  398.       if (this.browserFrame != null) {
  399.          this.browserFrame.setCursor(0);
  400.       }
  401.  
  402.       return true;
  403.    }
  404.  
  405.    public void SetSpeed(long theNewSpeed) {
  406.       this.speed = theNewSpeed;
  407.    }
  408.  
  409.    public long GetSpeed() {
  410.       return this.speed;
  411.    }
  412.  
  413.    public void start() {
  414.       if (this.tickTock == null) {
  415.          this.tickTock = new Thread(this);
  416.          this.tickTock.start();
  417.       }
  418.  
  419.    }
  420.  
  421.    public void stop() {
  422.       if (this.tickTock != null) {
  423.          this.tickTock.stop();
  424.          this.tickTock = null;
  425.       }
  426.  
  427.    }
  428.  
  429.    public void run() {
  430.       while(true) {
  431.          try {
  432.             Thread.currentThread();
  433.             Thread.sleep(this.speed);
  434.          } catch (InterruptedException var2) {
  435.          }
  436.  
  437.          super.repaint();
  438.       }
  439.    }
  440.  
  441.    public String getAppletInfo() {
  442.       return new String("NetObjects TickerTape");
  443.    }
  444.  
  445.    public String[][] getParameterInfo() {
  446.       String[][] info = new String[][]{{"text1", "string", "the text to display"}, {"speed", "integer", ""}, {"framecolor", "string", ""}, {"backcolor", "string", ""}, {"LEDcolor", "string", ""}, {"ledoffcolor", "string", ""}, {"FrameThick", "integer", ""}, {"LEDSize", "integer", ""}, {"scrollfactor", "integer", ""}, {"ledspacing", "integer", ""}, {"ledtype", "integer", "The shape of the LED: 0 = Square , 1 = Circular and 2 = Normal Font"}, {"href1", "URL", ""}};
  447.       return info;
  448.    }
  449.  
  450.    public int GetLine(char theCharacter, int theLine) {
  451.       int index = theCharacter & 255;
  452.       if (index >= 127 && index <= 160) {
  453.          index = 32;
  454.       } else if (index > 160) {
  455.          index -= 34;
  456.       }
  457.  
  458.       index -= 32;
  459.       if (index < 0) {
  460.          index = 0;
  461.       } else if (index > 189) {
  462.          index = 0;
  463.       }
  464.  
  465.       return this.itsData[index][theLine];
  466.    }
  467.  
  468.    public String About() {
  469.       return "Netobjects TickerTape";
  470.    }
  471.  
  472.    public void ISO8859() {
  473.    }
  474.  
  475.    public String ISOtoHTML(int theChar) {
  476.       return theChar >= 0 && theChar <= 255 ? this.theEntities[theChar] : "";
  477.    }
  478.  
  479.    public int HTMLtoISO(String theString) {
  480.       char secondChar = theString.charAt(1);
  481.       if (theString.charAt(0) != '&') {
  482.          return 0;
  483.       } else if (Character.isDigit(theString.charAt(1))) {
  484.          int result = Integer.valueOf(theString.substring(1, theString.indexOf(59, 2)));
  485.          return result;
  486.       } else {
  487.          switch (secondChar) {
  488.             case 'A':
  489.                if (theString.startsWith("Agrave;", 1)) {
  490.                   return 192;
  491.                } else if (theString.startsWith("Aacute;", 1)) {
  492.                   return 193;
  493.                } else if (theString.startsWith("Acirc;", 1)) {
  494.                   return 194;
  495.                } else if (theString.startsWith("Atilde;", 1)) {
  496.                   return 195;
  497.                } else if (theString.startsWith("Auml;", 1)) {
  498.                   return 196;
  499.                } else if (theString.startsWith("Aring;", 1)) {
  500.                   return 197;
  501.                } else if (theString.startsWith("AElig;", 1)) {
  502.                   return 198;
  503.                }
  504.             case 'C':
  505.                if (theString.startsWith("Ccedil;", 1)) {
  506.                   return 199;
  507.                }
  508.             case 'D':
  509.                if (theString.startsWith("Dstrok;", 1)) {
  510.                   return 208;
  511.                }
  512.             case 'E':
  513.                if (theString.startsWith("Egrave;", 1)) {
  514.                   return 200;
  515.                } else if (theString.startsWith("Eacute;", 1)) {
  516.                   return 201;
  517.                } else if (theString.startsWith("Ecirc;", 1)) {
  518.                   return 202;
  519.                } else if (theString.startsWith("Euml;", 1)) {
  520.                   return 203;
  521.                } else if (theString.startsWith("ETH;", 1)) {
  522.                   return 208;
  523.                }
  524.             case 'I':
  525.                if (theString.startsWith("Igrave;", 1)) {
  526.                   return 204;
  527.                } else if (theString.startsWith("Iacute;", 1)) {
  528.                   return 205;
  529.                } else if (theString.startsWith("Icirc;", 1)) {
  530.                   return 206;
  531.                } else if (theString.startsWith("Iuml;", 1)) {
  532.                   return 207;
  533.                }
  534.             case 'N':
  535.                if (theString.startsWith("Ntilde;", 1)) {
  536.                   return 209;
  537.                }
  538.             case 'O':
  539.                if (theString.startsWith("Ograve;", 1)) {
  540.                   return 210;
  541.                } else if (theString.startsWith("Oacute;", 1)) {
  542.                   return 211;
  543.                } else if (theString.startsWith("Ocirc;", 1)) {
  544.                   return 212;
  545.                } else if (theString.startsWith("Otilde;", 1)) {
  546.                   return 213;
  547.                } else if (theString.startsWith("Ouml;", 1)) {
  548.                   return 214;
  549.                } else if (theString.startsWith("Oslash;", 1)) {
  550.                   return 216;
  551.                }
  552.             case 'T':
  553.                if (theString.startsWith("THORN;", 1)) {
  554.                   return 222;
  555.                }
  556.             case 'U':
  557.                if (theString.startsWith("Ugrave;", 1)) {
  558.                   return 217;
  559.                } else if (theString.startsWith("Uacute;", 1)) {
  560.                   return 218;
  561.                } else if (theString.startsWith("Ucirc;", 1)) {
  562.                   return 219;
  563.                } else if (theString.startsWith("Uuml;", 1)) {
  564.                   return 220;
  565.                }
  566.             case 'Y':
  567.                if (theString.startsWith("Yacute;", 1)) {
  568.                   return 221;
  569.                }
  570.             case 'a':
  571.                if (theString.startsWith("agrave;", 1)) {
  572.                   return 224;
  573.                } else if (theString.startsWith("aacute;", 1)) {
  574.                   return 225;
  575.                } else if (theString.startsWith("acirc;", 1)) {
  576.                   return 226;
  577.                } else if (theString.startsWith("atilde;", 1)) {
  578.                   return 227;
  579.                } else if (theString.startsWith("auml;", 1)) {
  580.                   return 228;
  581.                } else if (theString.startsWith("aring;", 1)) {
  582.                   return 229;
  583.                } else if (theString.startsWith("aelig;", 1)) {
  584.                   return 230;
  585.                } else if (theString.startsWith("amp;", 1)) {
  586.                   return 38;
  587.                } else if (theString.startsWith("apos;", 1)) {
  588.                   return 39;
  589.                } else if (theString.startsWith("ast;", 1)) {
  590.                   return 42;
  591.                } else if (theString.startsWith("acute;", 1)) {
  592.                   return 180;
  593.                } else if (theString.startsWith("angst;", 1)) {
  594.                   return 197;
  595.                }
  596.             case 'b':
  597.                if (theString.startsWith("blank;", 1)) {
  598.                   return 32;
  599.                } else if (theString.startsWith("bsol;", 1)) {
  600.                   return 92;
  601.                } else if (theString.startsWith("brvbar;", 1)) {
  602.                   return 166;
  603.                } else if (theString.startsWith("brkbar;", 1)) {
  604.                   return 166;
  605.                }
  606.             case 'c':
  607.                if (theString.startsWith("ccedil;", 1)) {
  608.                   return 231;
  609.                } else if (theString.startsWith("comma;", 1)) {
  610.                   return 44;
  611.                } else if (theString.startsWith("colon;", 1)) {
  612.                   return 58;
  613.                } else if (theString.startsWith("commat;", 1)) {
  614.                   return 64;
  615.                } else if (theString.startsWith("circ;", 1)) {
  616.                   return 94;
  617.                } else if (theString.startsWith("caret;", 1)) {
  618.                   return 94;
  619.                } else if (theString.startsWith("cent;", 1)) {
  620.                   return 162;
  621.                } else if (theString.startsWith("curren;", 1)) {
  622.                   return 164;
  623.                } else if (theString.startsWith("copy;", 1)) {
  624.                   return 169;
  625.                } else if (theString.startsWith("cedil;", 1)) {
  626.                   return 184;
  627.                }
  628.             case 'd':
  629.                if (theString.startsWith("divide;", 1)) {
  630.                   return 247;
  631.                } else if (theString.startsWith("dollar;", 1)) {
  632.                   return 36;
  633.                } else if (theString.startsWith("dash;", 1)) {
  634.                   return 45;
  635.                } else if (theString.startsWith("die;", 1)) {
  636.                   return 168;
  637.                } else if (theString.startsWith("deg;", 1)) {
  638.                   return 176;
  639.                }
  640.             case 'e':
  641.                if (theString.startsWith("egrave;", 1)) {
  642.                   return 232;
  643.                } else if (theString.startsWith("eacute;", 1)) {
  644.                   return 233;
  645.                } else if (theString.startsWith("ecirc;", 1)) {
  646.                   return 234;
  647.                } else if (theString.startsWith("euml;", 1)) {
  648.                   return 235;
  649.                } else if (theString.startsWith("eth;", 1)) {
  650.                   return 240;
  651.                } else if (theString.startsWith("excl;", 1)) {
  652.                   return 33;
  653.                } else if (theString.startsWith("equals;", 1)) {
  654.                   return 61;
  655.                }
  656.             case 'f':
  657.                if (theString.startsWith("frac14;", 1)) {
  658.                   return 188;
  659.                } else if (theString.startsWith("frac12;", 1)) {
  660.                   return 189;
  661.                } else if (theString.startsWith("frac34;", 1)) {
  662.                   return 190;
  663.                }
  664.             case 'g':
  665.                if (theString.startsWith("gt;", 1)) {
  666.                   return 62;
  667.                } else if (theString.startsWith("grave;", 1)) {
  668.                   return 96;
  669.                }
  670.             case 'h':
  671.                if (theString.startsWith("hyphen;", 1)) {
  672.                   return 45;
  673.                } else if (theString.startsWith("hibar;", 1)) {
  674.                   return 175;
  675.                } else if (theString.startsWith("half;", 1)) {
  676.                   return 189;
  677.                }
  678.             case 'i':
  679.                if (theString.startsWith("igrave;", 1)) {
  680.                   return 236;
  681.                } else if (theString.startsWith("iacute;", 1)) {
  682.                   return 237;
  683.                } else if (theString.startsWith("icirc;", 1)) {
  684.                   return 238;
  685.                } else if (theString.startsWith("iuml;", 1)) {
  686.                   return 239;
  687.                } else if (theString.startsWith("iexcl;", 1)) {
  688.                   return 161;
  689.                } else if (theString.startsWith("iquest;", 1)) {
  690.                   return 191;
  691.                }
  692.             case 'l':
  693.                if (theString.startsWith("lpar;", 1)) {
  694.                   return 40;
  695.                } else if (theString.startsWith("lt;", 1)) {
  696.                   return 60;
  697.                } else if (theString.startsWith("lsqb;", 1)) {
  698.                   return 91;
  699.                } else if (theString.startsWith("lowbar;", 1)) {
  700.                   return 95;
  701.                } else if (theString.startsWith("lcub;", 1)) {
  702.                   return 123;
  703.                } else if (theString.startsWith("laquo;", 1)) {
  704.                   return 171;
  705.                }
  706.             case 'm':
  707.                if (theString.startsWith("minus;", 1)) {
  708.                   return 45;
  709.                } else if (theString.startsWith("macr;", 1)) {
  710.                   return 175;
  711.                } else if (theString.startsWith("micro;", 1)) {
  712.                   return 181;
  713.                } else if (theString.startsWith("middot;", 1)) {
  714.                   return 183;
  715.                }
  716.             case 'n':
  717.                if (theString.startsWith("ntilde;", 1)) {
  718.                   return 241;
  719.                } else if (theString.startsWith("num;", 1)) {
  720.                   return 35;
  721.                } else if (theString.startsWith("nbsp;", 1)) {
  722.                   return 160;
  723.                } else if (theString.startsWith("not;", 1)) {
  724.                   return 172;
  725.                }
  726.             case 'o':
  727.                if (theString.startsWith("ograve;", 1)) {
  728.                   return 242;
  729.                } else if (theString.startsWith("oacute;", 1)) {
  730.                   return 243;
  731.                } else if (theString.startsWith("ocirc;", 1)) {
  732.                   return 244;
  733.                } else if (theString.startsWith("otilde;", 1)) {
  734.                   return 245;
  735.                } else if (theString.startsWith("ouml;", 1)) {
  736.                   return 246;
  737.                } else if (theString.startsWith("oslash;", 1)) {
  738.                   return 248;
  739.                } else if (theString.startsWith("ordf;", 1)) {
  740.                   return 170;
  741.                } else if (theString.startsWith("ordm;", 1)) {
  742.                   return 186;
  743.                }
  744.             case 'p':
  745.                if (theString.startsWith("percnt;", 1)) {
  746.                   return 37;
  747.                } else if (theString.startsWith("plus;", 1)) {
  748.                   return 43;
  749.                } else if (theString.startsWith("period;", 1)) {
  750.                   return 46;
  751.                } else if (theString.startsWith("pound;", 1)) {
  752.                   return 163;
  753.                } else if (theString.startsWith("plusmn;", 1)) {
  754.                   return 177;
  755.                } else if (theString.startsWith("para;", 1)) {
  756.                   return 182;
  757.                }
  758.             case 'q':
  759.                if (theString.startsWith("quot;", 1)) {
  760.                   return 34;
  761.                } else if (theString.startsWith("quest;", 1)) {
  762.                   return 63;
  763.                }
  764.             case 'r':
  765.                if (theString.startsWith("rpar;", 1)) {
  766.                   return 41;
  767.                } else if (theString.startsWith("rsqb;", 1)) {
  768.                   return 93;
  769.                } else if (theString.startsWith("rcub;", 1)) {
  770.                   return 125;
  771.                } else if (theString.startsWith("reg;", 1)) {
  772.                   return 174;
  773.                } else if (theString.startsWith("raquo;", 1)) {
  774.                   return 187;
  775.                }
  776.             case 's':
  777.                if (theString.startsWith("sp;", 1)) {
  778.                   return 32;
  779.                } else if (theString.startsWith("sol;", 1)) {
  780.                   return 47;
  781.                } else if (theString.startsWith("semi;", 1)) {
  782.                   return 59;
  783.                } else if (theString.startsWith("sim;", 1)) {
  784.                   return 126;
  785.                } else if (theString.startsWith("sect;", 1)) {
  786.                   return 167;
  787.                } else if (theString.startsWith("shy;", 1)) {
  788.                   return 173;
  789.                } else if (theString.startsWith("sup2;", 1)) {
  790.                   return 178;
  791.                } else if (theString.startsWith("sup3;", 1)) {
  792.                   return 179;
  793.                } else if (theString.startsWith("sup1;", 1)) {
  794.                   return 185;
  795.                }
  796.             case 't':
  797.                if (theString.startsWith("thorn;", 1)) {
  798.                   return 254;
  799.                } else if (theString.startsWith("tilde;", 1)) {
  800.                   return 126;
  801.                } else if (theString.startsWith("times;", 1)) {
  802.                   return 215;
  803.                }
  804.             case 'u':
  805.                if (theString.startsWith("ugrave;", 1)) {
  806.                   return 249;
  807.                } else if (theString.startsWith("uacute;", 1)) {
  808.                   return 250;
  809.                } else if (theString.startsWith("ucirc;", 1)) {
  810.                   return 251;
  811.                } else if (theString.startsWith("uuml;", 1)) {
  812.                   return 252;
  813.                } else if (theString.startsWith("uml;", 1)) {
  814.                   return 168;
  815.                }
  816.             case 'y':
  817.                if (theString.startsWith("yacute;", 1)) {
  818.                   return 253;
  819.                } else if (theString.startsWith("yuml;", 1)) {
  820.                   return 255;
  821.                } else if (theString.startsWith("yen;", 1)) {
  822.                   return 165;
  823.                }
  824.             case 'B':
  825.             case 'F':
  826.             case 'G':
  827.             case 'H':
  828.             case 'J':
  829.             case 'K':
  830.             case 'L':
  831.             case 'M':
  832.             case 'P':
  833.             case 'Q':
  834.             case 'R':
  835.             case 'S':
  836.             case 'V':
  837.             case 'W':
  838.             case 'X':
  839.             case 'Z':
  840.             case '[':
  841.             case '\\':
  842.             case ']':
  843.             case '^':
  844.             case '_':
  845.             case '`':
  846.             case 'j':
  847.             case 'k':
  848.             case 'v':
  849.             case 'w':
  850.             case 'x':
  851.             default:
  852.                return 0;
  853.          }
  854.       }
  855.    }
  856. }
  857.